package io.gitee.duxiuhuan.mailbox.outter;

import io.gitee.duxiuhuan.mailbox.service.entries.QuestionResult;
import io.gitee.duxiuhuan.mailbox.service.inter.TalkWithAI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;

@Component
public class TalkWithAIUtils {
    
    @Autowired
    private TalkWithAI talkWithAI;
    
    public QuestionResult question(String message, Long userId, Long sessionId, String model, Long tableId) {
        return this.question(message, userId, sessionId, model, "table_" + tableId.toString());
    }

    public QuestionResult question(String message, Long userId, Long sessionId, String model, String tableName) {
        return talkWithAI.question(message, userId, sessionId, model, tableName);
    }

    public StreamingResponseBody questionStream(String message, Long userId, Long sessionId, String model, Long tableId) {
        return this.questionStream(message, userId, sessionId, model,"table_" + tableId.toString());
    }
    
    public StreamingResponseBody questionStream(String message, Long userId, Long sessionId, String model, String tableName) {
        return talkWithAI.questionStream(message, userId, sessionId, model,tableName);
    }
}
